/**  
 *	VisualGroup JavaScript prototype Classes, version 0.1
 *  (c) 2008 Bill Vison <vison_ruan@126.com>
 *
 *
/*--------------------------------------------------------------------------*/
using("Vsg.Component");

Vsg.Component.AStockFinaceFlowingPanel = Ext.extend(Ext.grid.GridPanel,{
	
	defaultMethod:function($config) {
		// --- defind basic defined ---
		if ($config == null) {
			throw "Do not defined a basic config for object!";
		}
		// define renderer value
		function renValue(val) {
        	if(val > 0){
            	return '<span style="color:green;">' + '￥'+ val + '</span>';
        	}else if(val < 0){
            	return '<span style="color:red;">' + '￥'+ val + '</span>';
        	}
        	return val;			
		}
		
		var $_con = {
			height:"100%",
			iconCls:"icon-grid",
			viewConfig:{forceFit:true},
			sm:new Ext.grid.RowSelectionModel({singleSelect:true}),
			colModel:new Ext.grid.ColumnModel([
				new Ext.grid.RowNumberer(),
				{
					header: "日 期",
					width: 35,
					sortable: false,
					dataIndex: "stockdate"
				
				},
				{
					header: "主力/机构对冲金额",
					width: 55,
					sortable: false,
					renderer: renValue,
					dataIndex: "mainDiffAmount"
				},
				{
					header: "散单对冲金额",
					width: 50,
					renderer: renValue,
					sortable: true,
					dataIndex: "retailDiffAmount"
				}				
			])
		};


		try {
			
			// --- add top tool bar ----
	
			
			for (var $i in $config) {
				$_con[$i] = $config[$i];
			}
			
		} catch (e) {
			// -- catch default value defined ---
			alert(e);
		}
		return $_con;		
			
	},
	
	
	constructor:function($config) {

		var $attrs = this.defaultMethod($config);
        
		Ext.applyIf(this, $attrs);
        
		Vsg.Component.AStockFinaceFlowingPanel.superclass.constructor.call(this, $attrs);
		
	}
});